#ifndef IMGVIEWWIDGET_H
#define IMGVIEWWIDGET_H

#include <QtGui/QWidget>
#include <QtGUI/QImage>
#include <QtCore/QPoint>
#include "Portability.h"

class ImgViewWidget : public QWidget
{
	Q_OBJECT

public:
	ImgViewWidget(QWidget *parent=0);
	virtual ~ImgViewWidget();

public slots:
	void setImageFile(const QString&);
	void zoomIn();
	void zoomOut();
	void zoomOriginalSize();
	void zoomWindowSize();

	void rotateRight();
	void rotateLeft();
signals:
	void doubleClicked();
	void leftMouseMoved();
	void rightMouseMoved();
protected:
	virtual void mouseDoubleClickEvent ( QMouseEvent * event ) override;
	virtual void paintEvent ( QPaintEvent * event ) override;
	
	virtual void mousePressEvent ( QMouseEvent * event ) override;
	virtual void mouseReleaseEvent ( QMouseEvent * event ) override;
	virtual void mouseMoveEvent ( QMouseEvent * event ) override;
private:
	QString _imgFileName;
	QImage _image;

	QPoint _mousePressPoint;

	void drawImageInfo(QPainter&);
	int _rotateAngle;

	bool _isZoomToWin;
	int _xOffset;
	int _yOffset;
	int _lstXOffset;
	int _lstYOffset;
	int _zoomCount;

	void loadImageFile();
};

#endif // IMGVIEWWIDGET_H
